cmake_minimum_required(VERSION 3.0)
project(sgm_cuda)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 11)

list(APPEND CMAKE_PREFIX_PATH "$ENV{CUDA_ROOT}")
list(APPEND CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH}")

set(DEVICE_COMPILER "nvcc")
set(CUDA_COMPILER "${DEVICE_COMPILER}" CACHE STRING "Select the device compiler")

set(CUDA_ARCH "20;30;35;37;50;52;60;61;62" CACHE STRING "Set GPU architecture (semicolon separated list, e.g. '-DCUDA_ARCH=20;35;60')")
find_package(CUDA 10.2 REQUIRED)
find_package(OpenCV REQUIRED)
set(LIBS ${LIBS} ${CUDA_LIBRARIES})


#set(
#    CUDA_NVCC_FLAGS
#    ${CUDA_NVCC_FLAGS};
##    -O3 -lineinfo
##    -gencode=arch=compute_30,code=sm_30
##    -gencode=arch=compute_35,code=sm_35
##    -gencode=arch=compute_50,code=sm_50
##    -gencode=arch=compute_52,code=sm_52
#    )

cuda_add_executable(
    sgm
    main.cu median_filter.cu hamming_cost.cu disparity_method.cu debug.cu costs.cu)

target_link_libraries( sgm ${OpenCV_LIBS} )
